package ca.scotthyndman.as2haxe.dom;

/**
 * Holds words that cannot be used as identifiers.
 */
public final class ASReservedWords {
	public static final String[] KEYWORDS = {
			"function", "class", "var", "if", "else", "while", "do", "for",
			"break", "continue", "return", "extends", "implements", "import",
			"switch", "case", "default", "static", "public", "private", "try",
			"catch", "new", "extern", "enum", "in",
			"interface", "untyped", "cast"
	};

	/**
	 * Returns <code>true</code> if <code>word</code> is a reserved word.
	 * 
	 * @param word
	 *            the word to check
	 * @return <code>true</code> if it is a reserved word
	 */
	public static boolean isReservedWord(String word) {
		for (String keyword : KEYWORDS) {
			if (keyword.equals(word)) {
				return true;
			}
		}

		return false;
	}
}
